
package cz.czu.pef.DataModelling.domainObjects;

import java.util.*;

public class ExternalWorker extends Employee implements IdObject
{
  private static final long serialVersionUID = 7401129486691132721L;

  /*
   * Entity attributes (some inherited)
   */

  /*
	 * Relations
	 */
	private Set<Company> externalEmployers;

	public ExternalWorker()
	{
		super();
	}

	public ExternalWorker(Person person)
	{
		super(person);
	}

	public void addExternalEmployer(Company newEmployer)
	{
		if (externalEmployers == null)
			externalEmployers = new HashSet<Company>();
		externalEmployers.add(newEmployer);
	}

	public Set<Company> getExternalEmployers()
	{
		return externalEmployers;
	}

	public List<Company> getExternalEmployersAsList()
	{
		return new ArrayList<Company>(getExternalEmployers());
	}

	
  public void setExternalEmployers(Set<Company> externalEmployers)
  {
    this.externalEmployers = externalEmployers;
  }

  public String toString()
	{
		StringBuilder builder = new StringBuilder();
		builder.append("ExternalWorker [toString()=");
		builder.append(super.toString());
		builder.append("]");
		return builder.toString();
	}
}